package com.cmsz.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cmsz.dao.ITwo;
import com.cmsz.service.DBService;
import com.cmsz.service.ITestComponent;


@RestController
public class MyController {
	
	
	@Autowired
	private ITestComponent testComponent;
	
	@Autowired
	private DBService dBService; 
	
//	@Autowired
//	private ApplicationContext applicationContext;
	
	
	@Autowired
	@Qualifier("two1")
	private ITwo two; 
	
	
//	@Autowired
	public MyController(DBService dBService) {
		super();
		this.dBService = dBService;
	}


	@RequestMapping("/two")
	public String two(){
		two.func();
		return "two";
	}
	
	
//	@Autowired
	public void setdBService(DBService dBService) {
		this.dBService = dBService;
	}

	@RequestMapping("/test")
	public String test(){
		testComponent.func("123");
		return "123";
	}
	
	@RequestMapping("/test1")
	public String db(){
		dBService.func("baozheng");
		return "baozheng";
	}

}
